import { FormConfig } from '@/components'
import { Row } from '@/components/FTable/components/search'
import { basicDataCurryFilter, configCurryFilter } from '@/dictionaries/filter'
import { BaseDto, Status } from '@/interfaces'
import { isTrue } from '@/utils/tools'
import dayjs from 'dayjs'
import { shallowRef } from 'vue'
/*
 * @Description:
 * @Author: fhw
 * @Date: 2023-02-23 14:41:28
 */
export const columns: F.TableColumns[] = [
	{
		title: 'id',
		key: 'id',
		dataIndex: 'id',
		align: 'center',
		width: 150
	},
	{
		title: '名称',
		key: 'name',
		dataIndex: 'name',
		align: 'center',
		width: 200
	},
	{
		title: '语言',
		key: 'lang',
		dataIndex: 'lang',
		align: 'center', width: 180,
		customRender: configCurryFilter('lang'),
	},
	{
		title: '创建时间',
		key: 'createDate',
		dataIndex: 'createDate',
		align: 'center',
		width: 180,
		customRender: ({ record }: F.RableSlotScope<defs.server.CategoryEntity>) =>
			record.createDate && dayjs(record.createDate).format('YYYY-MM-DD HH:mm:ss'),
	},
	{
		title: '更新时间',
		key: 'updateDate',
		dataIndex: 'updateDate',
		align: 'center',
		width: 180,
		customRender: ({ record }: F.RableSlotScope<defs.server.CategoryEntity>) =>
			record.updateDate && dayjs(record.updateDate).format('YYYY-MM-DD HH:mm:ss'),
	},
	{
		title: '操作',
		dataIndex: 'action',
		key: 'action',
		align: 'center',
		slots: {
			customRender: 'actionRender',
		},
		width: 300,
		fixed: 'right',
	},
]
export const rows: Array<Row> = [
	{
		title: '名称',
		key: 'name',
		component: 'a-input',
	},
	{
		title: '语言',
		key: 'lang',
		component: shallowRef(FormConfig),
		props: {
			prop: 'lang',
		},
	},
]